//
//  VocherCell.m
//  meiyinxiang
//
//  Created by apple on 2017/11/9.
//  Copyright © 2017年 hbjApple. All rights reserved.
//

#import "VocherCell.h"
@interface VocherCell()
@property (weak, nonatomic) IBOutlet UIImageView *vocherIcon;
@property (weak, nonatomic) IBOutlet UILabel *moneyNumLabel;
@property (weak, nonatomic) IBOutlet UILabel *conditionLabel;
@property (weak, nonatomic) IBOutlet UILabel *unlessTimeLabel;
@property (weak, nonatomic) IBOutlet UILabel *noconditonLabel;


@end
@implementation VocherCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
+(VocherCell *)loadNibWithVocherCell{
    UINib *nib = [UINib nibWithNibName:@"VocherCell" bundle:[NSBundle mainBundle]];
    return  [[nib instantiateWithOwner:nil options:nil]lastObject];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)setIndexPath:(NSIndexPath *)indexPath{
    NSInteger row = indexPath.row % 4 + 1;
    NSString *imageString = [NSString stringWithFormat:@"hongbaoxianjinjuan_kajuan%ld",row];
    self.vocherIcon.image = [UIImage imageNamed:imageString];
}
- (void)setVocherModel:(VocherViewModel *)vocherModel{
    self.moneyNumLabel.text = vocherModel.num;
    self.conditionLabel.text = vocherModel.condition.integerValue > 0 ? [NSString stringWithFormat:@"满%@减%@",vocherModel.condition,vocherModel.num] : @"现金抵用券";
    self.unlessTimeLabel.text = vocherModel.uselesstime;
    self.noconditonLabel.hidden = [self.conditionLabel.text isEqualToString:vocherModel.condition] ? YES : NO;
}
@end
